import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import TypeNav from '@/components/TypeNav'
// 执行mock
import '@/mock'
//统一引入:将所有api函数全部引入
import * as API from '@/api'
//引入elementui
import { Dialog, Button, } from 'element-ui'
// 图片懒加载
import VueLazyload from 'vue-lazyload'
import defaultImg from '@/assets/images/lostImg.jpg'
Vue.use(VueLazyload, {
  error: defaultImg,
  loading: defaultImg
})
Vue.config.productionTip = false
//由于三级联动导航常用,将其注册为全局组件
Vue.component(TypeNav.name, TypeNav)
Vue.component(Dialog.name, Dialog)
Vue.component(Button.name, Button)
new Vue({
  //注册仓库
  store,
  //注册路由
  router,
  render: (h) => h(App),
  beforeCreate() {
    //配置全局事件总线
    Vue.prototype.$bus = this
    // 将全部请求函数挂载到原型对象身上
    Vue.prototype.$API = API
  }
}).$mount('#app')
